package zhongbo.java.air.dictionary.model;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import zhongbo.java.air.dictionary.model.enums.AirCraftStatus;
import zhongbo.java.air.dictionary.model.enums.AirCraftType;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.PastOrPresent;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * 说明：
 *
 * @author 钟波dellNotebook
 * @since 2025年03月30日 星期日 19:33:03
 */

// todo navicat执行schema-mysql.sql中的sql,创建表
// 根据表结构,创建对应的java实体,以及相关的增删改查的所有代码

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@ApiModel("飞机信息")
@TableName("air_aircraft")
public class AirCraft {

    @TableId(type = IdType.ASSIGN_UUID)
    @ApiModelProperty("主键id")
    @Size(min = 1, max = 36, message = "主键长度是1~36的UUID")
    @NotNull(message = "主键不能为空")
    private String id;

    @ApiModelProperty(value = "唯一业务编号", example = "001")
    @TableField("icao_code")
    @Size(min = 1, max = 6, message = "唯一业务编号长度是1~6")
    @NotNull(message = "唯一业务编号不能为空")
    private String icaoCode;

    @ApiModelProperty(value = "飞机注册号", example = "001")
    @TableField("registration")
    @Size(min = 1, max = 20, message = "飞机注册号长度是1~20")
    @NotNull(message = "飞机注册号不能为空")
    private String registration;

    @ApiModelProperty(value = "所属航空公司",example = "xx公司")
    @TableField("airline")
    @Size(min = 1, max = 100, message = "所属航空公司长度是1~100")
    @NotNull(message = "航空公司不能为空")
    private String airline;

    @ApiModelProperty(value = "机型",example = "B737_800")
    @TableField("aircraft_type")
    @Size(min = 1, max = 30, message = "机型长度是1~30")
    @NotNull(message = "机型不能为空")
    private AirCraftType aircraftType;

    @ApiModelProperty(value = "状态",example = "ACTIVE")
    @TableField("status")
    @Pattern(regexp = "^(ACTIVE|MAINTENANCE|RETIRED)$", message = "状态必须是 ACTIVE, MAINTENANCE 或 RETIRED")
    @NotNull(message = "状态不能为空")
    private AirCraftStatus status;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "创建时间",example = "2025-03-31 16:29:30")
    @TableField("create_time")
    @PastOrPresent(message = "创建时间必须是过去或现在")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "更新时间",example = "2025-03-31 16:29:30")
    @TableField("update_time")
    @PastOrPresent(message = "创建时间必须是过去或现在")
    private Date updateTime;

}

